// MyCMD.h

#ifndef _MYCMD_h
#define _MYCMD_h

#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif

#define		MaxInsLen			20
#define		MaxInsNum			100


typedef enum {
	InsHelp = 0,
	InsSet,
	InsGet,
	InsAction,
	InsNum,
}InsType_t;

typedef struct {
	char Ins[MaxInsNum][MaxInsLen];
	uint8_t effInsNum;
	void(*cmdCB[MaxInsNum])(void*);
}CmdIns_t;

typedef struct {
	bool hasInf;
	uint8_t argc;
	char* argv[MaxInsLen];
	CmdIns_t CmdIns[InsNum];

	size_t(*print)(const char*);
	size_t(*println)(const char*);
	size_t(*printf)(const char* format, ...);
}CmdHandle_t;

void cmdTask(void* pvParameters);

void MyCMDInitHandle(CmdHandle_t* CmdHandle);

bool MyCMDRegisterIns(CmdHandle_t* CmdHandle, InsType_t type, char* Ins, void (*CB)(void*));
void MyCMDLoop(CmdHandle_t* CmdHandle);
#endif

